import request from '@/utils/request';
import { TreeHoles } from '@/api/interface/treeHoles';
import { Consultants, Teacher } from '@/api/interface/consultants';
import { Changelabel, Label } from '@/api/interface/label';
// import * as url from 'url';
import { Addcategory, Category, Changecategory } from '@/api/interface/Category';
import { Allslide, Delslide, Slide } from '@/api/interface/slide';
import { Article } from '@/api/interface/article';
import { Changetext } from '@/api/interface/text';

function getTreeList(params: TreeHoles) {
    return request({
        url: '/treeHole/hole/list',
        method: 'get',
        params: params
    });
}

// 获取轮播图
function getSlideshow(params: Slide) {
    return request({
        url: '/slideshow/list',
        method: 'get',
        params: params
    });
}

// 删除轮播图
function getDelslide(params: Delslide) {
    return request({
        url: `/slideshow/delete?ids=${params}`,
        method: 'delete'
        // params:params
    });
}

// 添加轮播图
function getAddslide(params: Allslide) {
    return request({
        url: '/slideshow/add',
        method: 'post',
        data: params
    });
}

// 编辑轮播图
function getChangeslide(params: Allslide) {
    return request({
        url: '/slideshow/edit',
        method: 'PUT',
        data: params
    });
}

// 获取文本
function getText(params: Text) {
    return request({
        url: '/platform/text/list',
        method: 'get',
        params: params
    });
}

// 编辑文本
function getChangetext(params: Changetext) {
    return request({
        url: '/platform/text/edit',
        method: 'PUT',
        data: params
    });
}

// 获取咨询师
function getTeach(params: Consultants) {
    return request({
        url: '/system/teacher/list',
        method: 'get',
        params: params
    });
}
// 咨询师添加
function getAddteacher(params:Teacher){
    return request({
        url:'/system/teacher',
        method:'post',
        data:params
    })
}
// 咨询师删除
function getDelteacher(params: any) {
    return request({
        url: '/system/teacher/' + params + '/',
        method: 'DELETE'
    });

}

// 修改咨询师
function getChangeteach(params: Teacher) {
    return request({
        url: '/system/teacher',
        method: 'PUT',
        data: params
    });
}

function getAllteach(params: Teacher) {
    return request({
        url: '/system/teacher/teacherAllList',
        method: 'get',
        data: params
    });
}
// 获取标签
function getLabel(params: Label) {
    return request({
        url: '/system/label/list',
        method: 'get',
        params: params
    });
}

// 标签删除
function getDellabel(params: any) {
    return request({
        url: '/system/label/' + params + '/',
        method: 'DELETE'
    });
}

// 标签添加
function getAddlabel(label: string) {
    return request({
        url: '/system/label',
        method: 'post',
        data: label
    });
}

// 标签编辑
function getChangelabel(params: Changelabel) {
    return request({
        url: '/system/label',
        method: 'PUT',
        data: params
    });
}


// 获取栏目分类
function getCategory(params: Category) {
    return request({
        url: '/system/category/list',
        method: 'get',
        params: params
    });
}

// 删除栏目分类
function getDelcategory(params: any) {
    return request({
        url: '/system/category/' + params + '/',
        method: 'delete'
    });
}

// 添加栏目分类
function getAddcategory(params: Addcategory) {
    return request({
        url: '/system/category',
        method: 'post',
        data: params
    });
}

// 编辑栏目
function getChangecategory(data: Changecategory) {
    return request({
        url: '/system/category',
        method: 'PUT',
        data: data
    });
}

// 获取文章
function getArticle(params: Article) {
    return request({
        url: '/system/article/list',
        method: 'get',
        data: params
    });
}

export {
    getTreeList, getSlideshow, getLabel,
    getText, getTeach, getDellabel,
    getDelteacher, getCategory, getDelcategory,
    getDelslide, getAddcategory, getAddlabel,
    getAddslide, getArticle, getChangecategory,
    getChangetext, getChangelabel, getChangeslide,
    getChangeteach,getAddteacher,getAllteach
};
